﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using LinqObj;
using ToolBoxPro;

public partial class orders : System.Web.UI.Page
{
    private int propertyID;
    private List<Order> orderList;
    private Campaign campaign;
    ToolboxDataContext tdc = new ToolboxDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        ((Label)Master.FindControl("lblTitle")).Text = "Manage Order";
        ((System.Web.UI.HtmlControls.HtmlImage)Master.FindControl("imgHeading")).Src = "images/icon_manage.gif";

        string t = "";
        if(Request.QueryString["task_num"] == null)
            t = Request.Form["task_num"];
        else
            t = Request.QueryString["task_num"];
        decimal total = 0;
        decimal otheramt = 0;
        if (t != null && t != "")
        {
            this.propertyID = Convert.ToInt32(t);
        }
        var category = from sc in tdc.Service_Categories
                       join s in tdc.Services on sc.service_category_id equals s.service_category_id
                       join o in tdc.Orders on s.service_id equals o.service_id
                       where o.campaign_id == this.propertyID
                       select sc;
        var distCategory = category.Distinct();

        foreach (var row in distCategory)
        {
            divContent.InnerHtml += "<div class='Order_Cat' >" + row.service_category1 + "</div>";
            var service = from s in tdc.Services
                          join o in tdc.Orders on s.service_id equals o.service_id
                          where s.service_category_id == Convert.ToInt32(row.service_category_id) && o.campaign_id == this.propertyID
                          select new { s.service_id, o.order_id, s.service_name, s.service_charge, s.service_category_id };
            divContent.InnerHtml += "<div >";

            string packageInof = "";

            foreach (var servicerow in service)
            {
                total = total + servicerow.service_charge;

                if (row.service_category1.Trim().ToLower() == "entry package"
                        || row.service_category1.Trim().ToLower() == "standard package"
                        || row.service_category1.Trim().ToLower() == "premium package"
                        || row.service_category1.Trim().ToLower() == "premium"
                        || row.service_category1.Trim().ToLower() == "intro package redhot deal"
                        )
                {
                    divContent.InnerHtml += "   <div style='margin-left:20px;' class='Order_Cat'><div class='order_service'><span style='float:left; width:600px;'>" + servicerow.service_name + "</span><span style='float:right; width:100px;text-align:right;padding-right:20px;'>$ " + servicerow.service_charge.ToString("#.00") + "</span></div></div>";
                }
                else
                {
                    if(servicerow.service_charge == 0)
                        divContent.InnerHtml += "   <div style='margin-left:20px;' class='technology'><div class='order_service'><span style='float:left; width:600px;'>" + servicerow.service_name + "</span><span style='float:right; width:100px;text-align:right;padding-right:20px;'>Quote</span></div></div>";
                    else
                        divContent.InnerHtml += "   <div style='margin-left:20px;' class='technology'><div class='order_service'><span style='float:left; width:600px;'>" + servicerow.service_name + "</span><span style='float:right; width:100px;text-align:right;padding-right:20px;'>$ " + servicerow.service_charge.ToString("#.00") + "</span></div></div>";
                }   

                divContent.InnerHtml += "   <div class='thelanguage' style='padding-left:50px;'><br/>";
                if (row.service_category1.ToLower().Equals("floorplan"))
                {
                    var serviceMoreInfo = from f in tdc.FloorPlanMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                          select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<span style='font-size:12px;'>Service Date: ";

                        if (serviceMoreInfo.Single().ServiceDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ServiceDate.Value.ToShortDateString();

                        string daytime = "", h = "0", m = "0";
                        string strtime = serviceMoreInfo.Single().ServiceTime.ToString();
                        string[] time = strtime.Split('-');

                        if (strtime.IndexOf('-') > 0)
                        {
                            h = time[0];
                            m = time[1];
                            daytime = time[2];
                        }
                        
                        if(m == "0")
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": 00: " + daytime ;
                        else
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": " + m + ": " + daytime;

                        divContent.InnerHtml += "<br/> Art work Date: ";

                        if (serviceMoreInfo.Single().ArtWorkDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ArtWorkDate.Value.ToShortDateString();

                        divContent.InnerHtml += "<br/> Additional Info: " + serviceMoreInfo.Single().AdditionalInfo.Replace("\r\n", "<br/>");
                        divContent.InnerHtml += "<br/> File1: " + serviceMoreInfo.Single().File_1;
                        divContent.InnerHtml += "<br/> File2: " + serviceMoreInfo.Single().File_2;
                        divContent.InnerHtml += "<br/> File3: " + serviceMoreInfo.Single().File_3;
                        divContent.InnerHtml += "</span>";
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                else if (row.service_category1.ToLower().Equals("discount photo and plan combo"))
                {
                    var serviceMoreInfo = from f in tdc.DiscountPhotoMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                          select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<span style='font-size:12px;'>Service Date: ";

                        if (serviceMoreInfo.Single().ServiceDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ServiceDate.Value.ToShortDateString();

                        string daytime = "", h = "0", m = "0";
                        string strtime = serviceMoreInfo.Single().ServiceTime.ToString();
                        string[] time = strtime.Split('-');

                        if (strtime.IndexOf('-') > 0)
                        {
                            h = time[0];
                            m = time[1];
                            daytime = time[2];
                        }

                        if (m == "0")
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": 00: " + daytime;
                        else
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": " + m + ": " + daytime;

                        divContent.InnerHtml += "<br/> Art work Date: ";

                        if (serviceMoreInfo.Single().ArtWorkDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ArtWorkDate.Value.ToShortDateString();

                        divContent.InnerHtml += "<br/> Additional Info: " + serviceMoreInfo.Single().AdditionalInfo.Replace("\r\n", "<br/>");
                        divContent.InnerHtml += "<br/> File1: " + serviceMoreInfo.Single().File_1;
                        divContent.InnerHtml += "<br/> File2: " + serviceMoreInfo.Single().File_2;
                        divContent.InnerHtml += "<br/> File3: " + serviceMoreInfo.Single().File_3;
                        divContent.InnerHtml += "</span>";
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                else if (row.service_category1.ToLower().Equals("photography"))
                {
                    var serviceMoreInfo = from f in tdc.PhotographyMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                  select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<span style='font-size:12px;'>Service Date: ";

                        if (serviceMoreInfo.Single().ServiceDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ServiceDate.Value.ToShortDateString();

                        string daytime = "", h = "0", m = "0";
                        string strtime = serviceMoreInfo.Single().ServiceTime.ToString();
                        string[] time = strtime.Split('-');

                        if (strtime.IndexOf('-') > 0)
                        {
                            h = time[0];
                            m = time[1];
                            daytime = time[2];
                        }

                        if (m == "0")
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": 00: " + daytime;
                        else
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": " + m + ": " + daytime;

                        divContent.InnerHtml += "<br/> Art work Date: ";

                        if (serviceMoreInfo.Single().ArtWorkDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ArtWorkDate.Value.ToShortDateString();

                        divContent.InnerHtml += "<br/> Additional Info: " + serviceMoreInfo.Single().AdditionalInfo.Replace("\r\n", "<br/>");
                        divContent.InnerHtml += "</span>";
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                else if (row.service_category1.ToLower().Equals("copywriting"))
                {
                    var serviceMoreInfo = from f in tdc.CopyWritingMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                  select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<span style='font-size:12px;'>Service Date: ";

                        if (serviceMoreInfo.Single().ServiceDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ServiceDate.Value.ToShortDateString();

                        string daytime = "", h = "0", m = "0";
                        string strtime = serviceMoreInfo.Single().ServiceTime.ToString();
                        string[] time = strtime.Split('-');

                        if (strtime.IndexOf('-') > 0)
                        {
                            h = time[0];
                            m = time[1];
                            daytime = time[2];
                        }

                        if (m == "0")
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": 00: " + daytime;
                        else
                            divContent.InnerHtml += "<br/> Service Time: " + h + ": " + m + ": " + daytime;

                        divContent.InnerHtml += "<br/> Art work Date: ";

                        if (serviceMoreInfo.Single().ArtWorkDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().ArtWorkDate.Value.ToShortDateString();

                        divContent.InnerHtml += "<br/> Additional Info: " + serviceMoreInfo.Single().AdditionalInfo.Replace("\r\n", "<br/>");
                        divContent.InnerHtml += "<br/> File1: " + serviceMoreInfo.Single().File_1;
                        divContent.InnerHtml += "</span>";
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                else if (row.service_category1.ToLower().Equals("other"))
                {
                    var serviceMoreInfo = from f in tdc.OtherMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                          select f;

                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<br/> Additional Info: " + serviceMoreInfo.Single().AdditionalInfo.Replace("\r\n", "<br/>");
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                else if (row.service_category1.ToLower().Equals("brochures"))
                {
                    var serviceMoreInfo = from f in tdc.BrochureMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                  select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<br/> Additional Info: " + serviceMoreInfo.Single().AdditionalInfo.Replace("\r\n", "<br/>");
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                else if (row.service_category1.ToLower().Equals("media management"))
                {
                    var serviceMoreInfo = from f in tdc.MediaMngMoreInfos
                                          where f.order_id == Convert.ToInt32(servicerow.order_id) && f.service_id == Convert.ToInt32(servicerow.service_id)
                                          select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<br/> Additional Info: " + serviceMoreInfo.Single().AdditionalInfo.Replace("\r\n", "<br/>");
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                else if (row.service_category1.ToLower().Equals("boards"))
                {
                    var serviceMoreInfo = from f in tdc.BoardMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                          select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        divContent.InnerHtml += "<span style='font-size:12px;'>Address: " + serviceMoreInfo.Single().Address + "<br/>";
                        divContent.InnerHtml += "<br/> Agency: " + serviceMoreInfo.Single().Agency;
                        divContent.InnerHtml += "<br/> Qyt: " + serviceMoreInfo.Single().Qty;                                               

                        if (serviceMoreInfo.Single().InstallType != null)
                        {
                            if (serviceMoreInfo.Single().InstallType.Trim().ToUpper() == "ON AWNING" || serviceMoreInfo.Single().InstallType.Trim().ToUpper() == "V-SHAPE")
                            {
                                divContent.InnerHtml += "<br/> Install Type ($110.00) : " + serviceMoreInfo.Single().InstallType;
                                otheramt += 110;
                            }
                            else
                            {
                                divContent.InnerHtml += "<br/> Install Type: " + serviceMoreInfo.Single().InstallType;
                            }
                        }

                        if (serviceMoreInfo.Single().VipService.ToString().ToLower().Equals("true"))
                        {
                            otheramt += 80;
                            divContent.InnerHtml += "<br/> VIP Services ($80.00) : Yes ";
                        }
                        else
                        {
                            divContent.InnerHtml += "<br/> VIP Services: No";
                        }

                        divContent.InnerHtml += "<br/> Install Date: ";

                        if (serviceMoreInfo.Single().InstallDate.HasValue)
                            divContent.InnerHtml += serviceMoreInfo.Single().InstallDate.Value.ToShortDateString();

                        divContent.InnerHtml += "<br/> Install Instructions: " + serviceMoreInfo.Single().InstallInstructions.Replace("\r\n", "<br/>");

                        divContent.InnerHtml += "</span>";
                    }
                    else
                        divContent.InnerHtml += "No extra information entered.";
                }
                
                divContent.InnerHtml += "<br/> ";
                divContent.InnerHtml += "</div>";

                if (row.service_category1.Trim().ToLower() == "entry package"
                                     || row.service_category1.Trim().ToLower() == "standard package"
                                     || row.service_category1.Trim().ToLower() == "premium package"
                                     || row.service_category1.Trim().ToLower() == "premium"
                        || row.service_category1.Trim().ToLower() == "intro package redhot deal"
                        )
                {
                    var serviceMoreInfo = from f in tdc.PackageMoreInfos
                                          where f.OrderID == Convert.ToInt32(servicerow.order_id) && f.ServiceID == Convert.ToInt32(servicerow.service_id)
                                          select f;
                    if (serviceMoreInfo.Count() > 0)
                    {
                        packageInof = "<br/><div style='padding: 0 0 0 20px; font-size:12px;' >" + row.service_category1 + "'s more info</div><br/>";
                        packageInof += "<div style='font-size:12px; padding-left: 50px;'>";

                        if (serviceMoreInfo.Single().ServiceDate.HasValue)
                            packageInof += "Service Date: " + serviceMoreInfo.Single().ServiceDate.Value.ToShortDateString();

                        string daytime = "", h = "0", m = "0";
                        string strtime = serviceMoreInfo.Single().ServiceTime.ToString();
                        string[] time = strtime.Split('-');

                        if (strtime.IndexOf('-') > 0)
                        {
                            h = time[0];
                            m = time[1];
                            daytime = time[2];
                        }

                        if (m == "0")
                            packageInof += "<br/> Service Time: " + h + ": 00: " + daytime;
                        else
                            packageInof += "<br/> Service Time: " + h + ": " + m + ": " + daytime;

                        packageInof += "<br/> Art work Date: ";

                        if (serviceMoreInfo.Single().ArtworkDate.HasValue)
                            packageInof += serviceMoreInfo.Single().ArtworkDate.Value.ToShortDateString() + "<br/>";

                        packageInof += "<br/> Board Date: " + serviceMoreInfo.Single().BoardDate;
                        packageInof += "<br/> Brochure Date: " + serviceMoreInfo.Single().BrochureDate;
                        packageInof += "<br/> Board install instructions: " + serviceMoreInfo.Single().BoardInstructions.Replace("\r\n", "<br/>");
                        packageInof += "<br/> Other instructions: " + serviceMoreInfo.Single().OtherInstructions.Replace("\r\n", "<br/>");
                        packageInof += "<br/> File1: " + serviceMoreInfo.Single().file_1;
                        packageInof += "<br/> File2: " + serviceMoreInfo.Single().file_2;
                        packageInof += "<br/> File3: " + serviceMoreInfo.Single().file_3;
                        packageInof += "<br/> File4: " + serviceMoreInfo.Single().file_4;
                        packageInof += "<br/> File5: " + serviceMoreInfo.Single().file_5;

                        packageInof += "</div>";
                    }
                    else
                        packageInof = "<br/><div style='padding-left:40px;' >No extra information entered.";
                }

            }
            if (row.service_category1.Trim().ToLower() == "entry package"
                                     || row.service_category1.Trim().ToLower() == "standard package"
                                     || row.service_category1.Trim().ToLower() == "premium package"
                                     || row.service_category1.Trim().ToLower() == "premium"
                        || row.service_category1.Trim().ToLower() == "intro package redhot deal"
                        )
            {
                divContent.InnerHtml += packageInof;
            }
            divContent.InnerHtml += "</div>";
            
        }
        total += otheramt;
        divContent.InnerHtml += "<div align='right' style='padding-right:35px;padding-top:5px;' ><b>Total: $ " + total.ToString("#.00") + "</b></div>";
        //grdCategory.DataSource = distCategory;
        //grdCategory.DataBind();
    }
    protected void grdCategory_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        Label lblCategoryID = new Label();
        lblCategoryID = (Label)e.Row.FindControl("lblCategoryID");
        Label lblCategory = new Label();
        lblCategory = (Label)e.Row.FindControl("lblCategory");
        GridView grdService = new GridView();
        grdService = (GridView)e.Row.FindControl("grdService");
        if (lblCategoryID != null)
        {
            var service = from s in tdc.Services
                          join o in tdc.Orders on s.service_id equals o.service_id
                          where s.service_category_id == Convert.ToInt32(lblCategoryID.Text) && o.campaign_id == this.propertyID
                          select new { s.service_id, o.order_id,s.service_name,s.service_charge,s.service_category_id };
            grdService.DataSource = service;
            grdService.DataBind();
        }
    }

    protected void grdService_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        Label lblSCategoryID = new Label();
        lblSCategoryID = (Label)e.Row.FindControl("lblSCategoryID");
        Label lblServiceID = new Label();
        lblServiceID = (Label)e.Row.FindControl("lblServiceID");
        Label lblSOrderID = new Label();
        lblSOrderID = (Label)e.Row.FindControl("lblSOrderID");
        HtmlGenericControl divMoreInfo = new HtmlGenericControl();
        divMoreInfo = (HtmlGenericControl)e.Row.FindControl("divMoreInfo");
        if (divMoreInfo != null)
        {
            var category = (from c in tdc.Service_Categories
                            where c.service_category_id == Convert.ToInt32(lblSCategoryID.Text)
                            select c).Single();
            if (category.service_category1.ToLower().Equals("floorplan"))
            {
                var service = from f in tdc.FloorPlanMoreInfos
                               where f.OrderID == Convert.ToInt32(lblSOrderID.Text) && f.ServiceID == Convert.ToInt32(lblServiceID.Text)
                               select f;
                if (service.Count() > 0)
                {
                    divMoreInfo.InnerHtml = "Service Date: " + service.Single().ServiceDate;
                    string daytime = "", h = "0", m = "0";
                    string strtime = service.Single().ServiceTime.ToString();
                    string[] time = strtime.Split('-');

                    if (strtime.IndexOf('-') > 0)
                    {
                        h = time[0];
                        m = time[1];
                        daytime = time[2];
                    }

                    divContent.InnerHtml += "<br/> Service Time: " + h + ": " + m + ": " + daytime;
                    divMoreInfo.InnerHtml += "<br/> Art work Date: " + service.Single().ArtWorkDate;
                    divMoreInfo.InnerHtml += "<br/> Additional Info: " + service.Single().AdditionalInfo;
                    divMoreInfo.InnerHtml += "<br/> File1: " + service.Single().File_1;
                    divMoreInfo.InnerHtml += "<br/> File2: " + service.Single().File_2;
                    divMoreInfo.InnerHtml += "<br/> File3: " + service.Single().File_3;
                }
                else
                    divMoreInfo.InnerHtml = "No extra information entered.";
            }
            else if (category.service_category1.ToLower().Equals("photography"))
            {
                var service = from f in tdc.PhotographyMoreInfos
                              where f.OrderID == Convert.ToInt32(lblSOrderID.Text) && f.ServiceID == Convert.ToInt32(lblServiceID.Text)
                              select f;
                if (service.Count() > 0)
                {
                    divMoreInfo.InnerHtml = "Service Date: " + service.Single().ServiceDate;
                    string daytime = "", h = "0", m = "0";
                    string strtime = service.Single().ServiceTime.ToString();
                    string[] time = strtime.Split('-');

                    if (strtime.IndexOf('-') > 0)
                    {
                        h = time[0];
                        m = time[1];
                        daytime = time[2];
                    }

                    divContent.InnerHtml += "<br/> Service Time: " + h + ": " + m + ": " + daytime;
                    divMoreInfo.InnerHtml += "<br/> Art work Date: " + service.Single().ArtWorkDate;
                    divMoreInfo.InnerHtml += "<br/> Additional Info: " + service.Single().AdditionalInfo;
                }
                else
                    divMoreInfo.InnerHtml = "No extra information entered.";
            }
            else if (category.service_category1.ToLower().Equals("copywriting"))
            {
                var service = from f in tdc.CopyWritingMoreInfos
                              where f.OrderID == Convert.ToInt32(lblSOrderID.Text) && f.ServiceID == Convert.ToInt32(lblServiceID.Text)
                              select f;
                if (service.Count() > 0)
                {
                    divMoreInfo.InnerHtml = "Service Date: " + service.Single().ServiceDate;
                    string daytime = "", h = "0", m = "0";
                    string strtime = service.Single().ServiceTime.ToString();
                    string[] time = strtime.Split('-');

                    if (strtime.IndexOf('-') > 0)
                    {
                        h = time[0];
                        m = time[1];
                        daytime = time[2];
                    }

                    divContent.InnerHtml += "<br/> Service Time: " + h + ": " + m + ": " + daytime;
                    divMoreInfo.InnerHtml += "<br/> Art work Date: " + service.Single().ArtWorkDate;
                    divMoreInfo.InnerHtml += "<br/> Additional Info: " + service.Single().AdditionalInfo;
                    divMoreInfo.InnerHtml += "<br/> File1: " + service.Single().File_1;
                }
                else
                    divMoreInfo.InnerHtml = "No extra information entered.";
            }
            else if (category.service_category1.ToLower().Equals("other"))
            {
                var service = from f in tdc.OtherMoreInfos
                              where f.OrderID == Convert.ToInt32(lblSOrderID.Text) && f.ServiceID == Convert.ToInt32(lblServiceID.Text)
                              select f;
                if (service.Count() > 0)
                {
                    divMoreInfo.InnerHtml += "<br/> Additional Info: " + service.Single().AdditionalInfo;
                }
                else
                    divMoreInfo.InnerHtml = "No extra information entered.";
            }
            else if (category.service_category1.ToLower().Equals("brochures"))
            {
                var service = from f in tdc.BrochureMoreInfos
                              where f.OrderID == Convert.ToInt32(lblSOrderID.Text) && f.ServiceID == Convert.ToInt32(lblServiceID.Text)
                              select f;
                if (service.Count() > 0)
                {
                    divMoreInfo.InnerHtml += "<br/> Additional Info: " + service.Single().AdditionalInfo;
                }
                else
                    divMoreInfo.InnerHtml = "No extra information entered.";
            }
            else if (category.service_category1.ToLower().Equals("media management"))
            {
                var service = from f in tdc.MediaMngMoreInfos
                              where f.order_id == Convert.ToInt32(lblSOrderID.Text) && f.service_id == Convert.ToInt32(lblServiceID.Text)
                              select f;
                if (service.Count() > 0)
                {
                    divMoreInfo.InnerHtml += "<br/> Additional Info: " + service.Single().AdditionalInfo;
                }
                else
                    divMoreInfo.InnerHtml = "No extra information entered.";
            }
            else if (category.service_category1.ToLower().Equals("boards"))
            {
                var service = from f in tdc.BoardMoreInfos
                              where f.OrderID == Convert.ToInt32(lblSOrderID.Text) && f.ServiceID == Convert.ToInt32(lblServiceID.Text)
                              select f;
                if (service.Count() > 0)
                {
                    divMoreInfo.InnerHtml = "Address: " + service.Single().Address;
                    divMoreInfo.InnerHtml += "<br/> Agency: " + service.Single().Agency;
                    divMoreInfo.InnerHtml += "<br/> Qyt: " + service.Single().Qty;
                    divMoreInfo.InnerHtml += "<br/> Install Type: " + service.Single().InstallType;
                    if(service.Single().VipService.ToString().ToLower().Equals("true"))
                        divMoreInfo.InnerHtml += "<br/> VIP Services: Yes";
                    else
                        divMoreInfo.InnerHtml += "<br/> VIP Services: No";
                    divMoreInfo.InnerHtml += "<br/> Install Date: " + service.Single().InstallDate;
                    divMoreInfo.InnerHtml += "<br/> Install Instructions: " + service.Single().InstallInstructions;
                }
                else
                    divMoreInfo.InnerHtml = "No extra information entered.";
            }
        }
    }
    
}
